<?php echo form_tag('project/save', array(
  'id'        => 'sf_admin_edit_form',
  'name'      => 'sf_admin_edit_form',
  'multipart' => true,
)) ?>

<?php echo object_input_hidden_tag($project, 'getId') ?>

<fieldset id="sf_fieldset_none" class="">

<div class="form-row">
  <?php echo label_for('project[name]', __($labels['project{name}']), 'class="required" ') ?>
  <div class="content<?php if ($sf_request->hasError('project{name}')): ?> form-error<?php endif; ?>">
  <?php if ($sf_request->hasError('project{name}')): ?>
    <?php echo form_error('project{name}', array('class' => 'form-error-msg')) ?>
  <?php endif; ?>

  <?php $value = object_input_tag($project, 'getName', array (
  'size' => 50,
  'control_name' => 'project[name]',
)); echo $value ? $value : '&nbsp;' ?>
    </div>
</div>

<div class="form-row">
  <?php echo label_for('project[client_id]', __($labels['project{client_id}']), 'class="required" ') ?>
  <div class="content<?php if ($sf_request->hasError('project{client_id}')): ?> form-error<?php endif; ?>">
  <?php if ($sf_request->hasError('project{client_id}')): ?>
    <?php echo form_error('project{client_id}', array('class' => 'form-error-msg')) ?>
  <?php endif; ?>

  <?php $value = object_select_tag($project, 'getClientId', array (
  'related_class' => 'Client',
  'control_name' => 'project[client_id]',
      'peer_method'=>'getSorted',
)); echo $value ? $value : '&nbsp;' ?>
    </div>
</div>

<div class="form-row">
  <?php echo label_for('project[saleno]', __($labels['project{saleno}']), 'class="required" ') ?>
  <div class="content<?php if ($sf_request->hasError('project{saleno}')): ?> form-error<?php endif; ?>">
  <?php if ($sf_request->hasError('project{saleno}')): ?>
    <?php echo form_error('project{saleno}', array('class' => 'form-error-msg')) ?>
  <?php endif; ?>

  <?php $value = object_input_tag($project, 'getSaleno', array (
  'size' => 50,
  'control_name' => 'project[saleno]',
)); echo $value ? $value : '&nbsp;' ?>
    </div>
</div>

<div class="form-row">
  <?php echo label_for('project[saledate]', __($labels['project{saledate}']), '') ?>
  <div class="content<?php if ($sf_request->hasError('project{saledate}')): ?> form-error<?php endif; ?>">
  <?php if ($sf_request->hasError('project{saledate}')): ?>
    <?php echo form_error('project{saledate}', array('class' => 'form-error-msg')) ?>
  <?php endif; ?>

  <?php $value = object_input_date_tag($project, 'getSaledate', array (
  'rich' => true,
  'calendar_button_img' => '/sf/sf_admin/images/date.png',
  'control_name' => 'project[saledate]',
)); echo $value ? $value : '&nbsp;' ?>
    </div>
</div>

<div class="form-row">
  <?php echo label_for('project[pe_id]', __($labels['project{pe_id}']), '') ?>
  <div class="content<?php if ($sf_request->hasError('project{pe_id}')): ?> form-error<?php endif; ?>">
  <?php if ($sf_request->hasError('project{pe_id}')): ?>
    <?php echo form_error('project{pe_id}', array('class' => 'form-error-msg')) ?>
  <?php endif; ?>

       <!--Tien-->
<select name="project[pe_id]"" id="project[pe_id]">
<?php
    $c = new Criteria();
    $c->add(sfGuardGroupPeer::NAME, "Project Engineer");
    $group = sfGuardGroupPeer::doSelectOne($c);
    if ($group){
        $c = new Criteria();
        $c->add(sfGuardUserGroupPeer::GROUP_ID, $group->getId());
        $userGroupList = sfGuardUserGroupPeer::doSelect($c);
        if ($userGroupList){
            foreach ($userGroupList as $userGroup){
                echo '<option value="' . $userGroup->getUserId().'" ';
                if ($userGroup->getUserId() == $project->getPeId())
                   echo  'selected="selected" >';
                else echo '>';
                $user = sfGuardUserPeer::retrieveByPK($userGroup->getUserId());
                echo $user? $user->getFullname(): '';
                echo '</option>';
            }
        }
    }
    
   ?>
   </select>
  
    </div>
</div>

<div class="form-row">
  <?php echo label_for('project[notes]', __($labels['project{notes}']), '') ?>
  <div class="content<?php if ($sf_request->hasError('project{notes}')): ?> form-error<?php endif; ?>">
  <?php if ($sf_request->hasError('project{notes}')): ?>
    <?php echo form_error('project{notes}', array('class' => 'form-error-msg')) ?>
  <?php endif; ?>

  <?php $value = object_textarea_tag($project, 'getNotes', array (
  'size' => '30x3',
  'control_name' => 'project[notes]',
)); echo $value ? $value : '&nbsp;' ?>
    </div>
</div>

</fieldset>

<?php include_partial('edit_actions', array('project' => $project)) ?>

</form>

<ul class="sf_admin_actions">
      <li class="float-left"><?php if ($project->getId()): ?>
<?php echo button_to(__('delete'), 'project/delete?id='.$project->getId(), array (
  'post' => true,
  'confirm' => __('Are you sure?'),
  'class' => 'sf_admin_action_delete',
)) ?><?php endif; ?>
</li>
  </ul>
